package coding.datastructures;

public class ReplaceWhitespace {

	public static void main(String[] args) {
		String str1 = "This is the best time    ";
		String swap = "%20";
		int len = str1.length();
		String[] str_array = str1.split(" ");
		System.out.println(str_array.length);
		String str2 = str_array[0];
		for (int i = 1; i < str_array.length; i++) {
			str2 = str2 + swap + str_array[i];
		}
		System.out.println(str2);
	}

}
